<?php

namespace App\Http\Controllers\Game\Setting;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Game\Setting\Maintenance\UpdateServerRequest;
use App\Http\Requests\Game\Setting\Maintenance\PublishBroadcastRequest;
use App\Http\Resources\Game\Setting\Maintenance\Broadcast\DataResource;
use App\Http\Resources\Common\DataResource as CommonDataResource;
use App\Services\Game\Setting\MaintenanceService;

class MaintenanceController extends Controller
{

    /**
     * 获取游戏服状态
     */
    public function getServerStatus(Request $request)
    {
        $data = MaintenanceService::make()->getServerStatus($request);

        return new CommonDataResource($data);
    }

    /**
     * 更新游戏服状态
     */
    public function updateServerStatus(UpdateServerRequest $request)
    {
        $data = MaintenanceService::make()->updateServerStatus($request);

        return new CommonDataResource($data);
    }

    /**
     * 获取游戏公告
     */
    public function getBroadcast(Request $request)
    {
        $data = MaintenanceService::make()->getBroadcast($request);

        return new DataResource($data);
    }

    /**
     * 发布游戏公告
     */
    public function publishBroadcast(PublishBroadcastRequest $request)
    {
        $data = MaintenanceService::make()->publishBroadcast($request);

        return new DataResource($data);
    }
}
